import java.lang.reflect.Array;
import java.util.Arrays;

public class TestDemo {
//    冒泡排序
    public static void my_bubblesort(int array[]) {
        boolean flg = false;
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j]>array[j+1]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                    flg = true;
                }
            }
            if(flg==false) {
                return;
            }
        }
    }
    public static void main(String[] args) {
        int[] array = {1,2,6,3,5,4};
        my_bubblesort(array);
        System.out.println(Arrays.toString(array));
    }
}
